﻿<form name="form_search" method="POST" action="?module=
<?php
echo $_GET['module'];
?>&amp;action=search" >
   <table class="tabela">
      <tr>
         <script type="text/javascript" language="JavaScript">
            <!--
            document.write('<td><input type="checkbox" name="search[]" id="cb1" value="kat" />Kategoria:<br>');
            document.write('<select name="kategoria" class="styled" size="8" onClick="selectCheckbox(document.getElementById(\'cb1\'));" onChange="fill(this.options.selectedIndex);" > ');
<?php
global $database;
$database->query("SELECT * FROM ucat");
while ($r=mysql_fetch_array($database->result))
{
   echo 'document.write(\'<option value="'.$r['ID'].'" >'.$r['name'].'</option> \');
                ';
}
?>
   document.write('</select> </td></tr><tr><td><br><input type="checkbox" name="search[]" id="cb2" value="podkat"  />');
   document.write('Podkategoria:<br><select name="podkategoria" class="styled" size="1" onClick="selectCheckbox(document.getElementById(\'cb2\'));"><option value="0">Wybierz kategorię</option></select> ');
   document.write('</td></tr><tr><td></td><td> ');
   //-->
         </script>
         <noscript>
            <?php
            include("noJS.php");
            ?>
         </noscript>
      </tr>

      <tr>
      <td><input type="checkbox" name="search[]" id="cb3" value="opis" />
      <br>Opis:<input type="text" class="styled" name="nazwa" onClick="selectCheckbox(document.getElementById('cb3'));" ><input type="submit" value="Szukaj" ></td>
      </tr>
   </table>
</form>
<script type="text/javascript" language="JavaScript">
   <!--
   var groups=document.form_search.kategoria.options.length;
   var group=new Array(groups);
   for (i=0; i<groups; i++)
      group[i]=new Array();
<?php
$i= 0;
//wczytywanie z DB podkategorii
$database->query("SELECT * FROM ucat");
$result=$database->getReturn();
while ($r=mysql_fetch_array($result))
{
   $n =$r['ID'];
   $database->query("SELECT * FROM `cat` WHERE `id_ucat` =$n");
   $j=0;
   while ($r2=mysql_fetch_array($database->result))
   {
      echo 'group['.$i.']['.$j++.']=new Option("'.$r2['name'].'","'.$r2['ID'].'");
           ';
   }
   $i++;
}
?>
   var temp=document.form_search.podkategoria;
   -->
</script>
